home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
76.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-17
|
822b
|
42 lines
/*
There may be additional include files required depending
upon the compile product you are using. Typical compilers
include Microsoft C by Microsoft or Turbo C by Boland Int'l.
*/
#include <stdio.h>
struct names{
char *person;
int number;
};
main()
{
static struct names class[] = {
"Rick", 1,
"John", 2,
"Jim", 3,
"Gary", 4,
"", 0
};
parray(class);
}
parray(list)
struct names list[];
{
int i, j;
/* print out names as strings */
for(i=0; list[i].person[0] != '\0'; i++){
printf("Name:%s",list[i].person);
printf("Number:%d",list[i].number);
}
/* print out EACH character of the name */
for(i=0, j=0; list[i].person[j] != '\0'; j=0, i++){
while(list[i].person[j] != '\0'){
printf("%c",list[i].person[j]);
j++;
}
printf("\n");
}
}